package com.ruoyi.project.jxc.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.project.jxc.domain.JxcDrug;
import com.ruoyi.project.jxc.domain.JxcMf;
import com.ruoyi.project.jxc.domain.JxcSup;
import com.ruoyi.project.jxc.mapper.JxcSupMapper;
import com.ruoyi.project.jxc.service.IJxcSupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JxcSupServiceImpl implements IJxcSupService {
    @Autowired
    private JxcSupMapper supMapper;
    @Override
    public List<JxcSup> selectSupList(JxcSup sup) {
        List<JxcSup> jxcSups = supMapper.selectSupList(sup);
        return jxcSups;
    }

    @Override
    public String checkSupNameUnique(JxcSup sup) {
        JxcSup jxcSup = supMapper.checkSupNameUnique(sup.getSupName());
        if(sup.equals(jxcSup)){
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    @Override
    public int insertSup(JxcSup sup) {

        return supMapper.insertSup(sup);
    }

    @Override
    public JxcSup selectSupById(Long supId) {
        return supMapper.selectSupById(supId);
    }

    @Override
    public int updateSup(JxcSup sup) {
        return supMapper.updateSup(sup);
    }

    @Override
    public int deleteSupById(Long[] supId) {
        return supMapper.deleteSupById(supId);
    }
}
